﻿using Microsoft.Extensions.Configuration;
using NPOI.SS.UserModel;
using static NPOI.SS.UserModel.MissingCellPolicy;

namespace DataTransfer.Core.Configurations
{
    /// <summary>
    /// 导入字段
    /// </summary>
    public class ExcelImportSheetFieldSetting
    {
        const string FIELD_NAME = "fieldName";
        const string FIELD_TYPE = "fieldType";
        const string DISPLAY_NAME = "displayName";
        const string ORDINAL = "ordinal";
        const string MISSING_CELL_POLICY = "missingCellPolicy";

        /// <summary>
        /// 字段名
        /// </summary>
        [ConfigurationKeyName(FIELD_NAME)]
        public string FieldName
        {
            get;
            set;
        }
        /// <summary>
        /// 字段显示名
        /// </summary>
        [ConfigurationKeyName(DISPLAY_NAME)]
        public string DisplayName
        {
            get;
            set;
        }
        /// <summary>
        /// 字段类型
        /// </summary>
        [ConfigurationKeyName(FIELD_TYPE)]
        public string FieldType
        {
            get;
            set;
        } = "System.String";
        
        /// <summary>
        /// 字段顺序
        /// </summary>
        [ConfigurationKeyName(ORDINAL)]
        public int Ordinal
        {
            get;
            set;
        }

        /// <summary>
        /// 缺失字段（单元格）处理规则
        /// </summary>
        [ConfigurationKeyName(MISSING_CELL_POLICY)]
        public MissingCellPolicy MissingCellPolicy
        {
            get;
            set;
        } = CREATE_NULL_AS_BLANK;

    }

}
